import 'package:xinxuan/vo/common_vo/common_pagination_vo.dart';
import 'package:xinxuan/vo/common_vo/common_times_vo.dart';

class SeckillListVo {

  List<SeckillGoodItem>? data;
  SeckillListMeta? meta;

  SeckillListVo({this.data, this.meta});

  SeckillListVo.fromJson(Map<String, dynamic> json) {
    if (json['data'] != null) {
      data = [];
      json['data'].forEach((v) {
        data!.add(new SeckillGoodItem.fromJson(v));
      });
    }
    meta = json['meta'] != null ? new SeckillListMeta.fromJson(json['meta']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data!.map((v) => v.toJson()).toList();
    }
    if (this.meta != null) {
      data['meta'] = this.meta!.toJson();
    }
    return data;
  }
}

class SeckillGoodItem {
  int? id;
  int? categoryId;
  String? title;
  String? image;
  String? originPrice;
  String? price;
  String? shoppingPrice;
  int? status;
  String? description;
  String? createdAt;
  String? updatedAt;

  SeckillGoodItem(
      {this.id,
      this.categoryId,
      this.title,
      this.image,
      this.originPrice,
      this.price,
      this.shoppingPrice,
      this.status,
      this.description,
      this.createdAt,
      this.updatedAt});

  SeckillGoodItem.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    categoryId = json['category_id'];
    title = json['title'];
    image = json['image'];
    originPrice = json['origin_price'];
    price = json['price'];
    shoppingPrice = json['shopping_price'];
    status = json['status'];
    description = json['description'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['category_id'] = this.categoryId;
    data['title'] = this.title;
    data['image'] = this.image;
    data['origin_price'] = this.originPrice;
    data['price'] = this.price;
    data['shopping_price'] = this.shoppingPrice;
    data['status'] = this.status;
    data['description'] = this.description;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.updatedAt;
    return data;
  }
}

class SeckillListMeta {
  CommonTimesVo? times;
  CommonPagination? pagination;

  SeckillListMeta({this.pagination, this.times});

  SeckillListMeta.fromJson(Map<String, dynamic> json) {
    times = json['times'] != null ? new CommonTimesVo.fromJson(json['times']) : null;
    pagination = json['pagination'] != null ? new CommonPagination.fromJson(json['pagination']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.times != null) {
      data['times'] = this.times!.toJson();
    }
    if (this.pagination != null) {
      data['pagination'] = this.pagination!.toJson();
    }
    return data;
  }
}
